/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tiberio.movil.utility.gson;

import android.net.ParseException;
import com.google.gson.*;
import com.tiberio.movil.entity.PollEntity;
import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map.Entry;

/**
 *
 * @author Chema
 */
public class PollDeserializer implements JsonDeserializer<ArrayList<PollEntity>>
{
    @Override
    public ArrayList<PollEntity> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext ctx) throws JsonParseException
    {
        JsonObject obj = json.getAsJsonObject();
        Entry<String, JsonElement> entry = obj.entrySet().iterator().next();
        if (entry == null) 
            return null;
        
        Date date;
        try
        {
            //date = df.parse(entry.getKey());
        }
        catch (ParseException e)
        {
            e.printStackTrace();
            date = null;
        }
        Long value = entry.getValue().getAsLong();
        return null;
    }
}

    

